<?php

/**
 * Le formulaire d'inscription au chat 
 */
class ZendChat_Form_Inscription extends Zend_Form {

    /**
     * Initialise un formulaire comportant :
     *  - un login
     *  - un password 
     */
    public function init() {
        $this->setMethod('post');

        // Initialisation du login
        $login = new Zend_Form_Element_Text('login');
        $login->addFilter('StringTrim')
                ->addFilter('HtmlEntities')
                ->setRequired(true)
                ->setAttrib('maxLength', 20)
                ->setLabel('Login')
                ->addValidator('StringLength', array(3, 20));
        $this->addElement($login);

        // Initialisation du pwd
        $pwd = new Zend_Form_Element_Password('pwd');
        $pwd->addFilter('StringTrim')
                ->setRequired(true)
                ->setAttrib('maxLength', 20)
                ->setLabel('Mot de passe')
                ->addValidator('StringLength', array(3, 20));
        $this->addElement($pwd);

        // Le bouton submit
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel("S'inscrire");
        $this->addElement($submit);
    }

}

